package com.tanhua.mangement.service;

import cn.hutool.core.convert.Convert;
import com.alibaba.dubbo.config.annotation.Reference;
import com.tanhua.dubbo.server.api.UserLikeApi;
import org.springframework.stereotype.Service;

@Service
public class GetUserCenterService {

    @Reference(version = "1.0.0")
    private UserLikeApi userLikeApi;

    //查询被喜欢的人数
    public Integer userCountBeLiked(Long userId) {
        Long fanCount = userLikeApi.queryFanCount(userId);
        return Convert.toInt(fanCount);
    }

    //查询喜欢的人数
    public Integer userCountLiked(Long userId) {
        Long likeCount = userLikeApi.queryLikeCount(userId);
        return Convert.toInt(likeCount);
    }

    //相互喜欢的
    public Integer userEachLoveCount(Long userId) {
        Long mutualLikeCount = userLikeApi.queryMutualLikeCount(userId);
        return Convert.toInt(mutualLikeCount);
    }
}
